from django.db import models

# Create your models here.

# 用户信息表
class User(models.Model):
    userName = models.CharField(max_length=40, null=True)
    nickName = models.CharField(max_length=40, null=True)
    userPassword = models.CharField(max_length=40, null=True)
    creatTime = models.DateTimeField(auto_now_add=True)
    refreshTime = models.DateTimeField(auto_now=True)

    class Meta:
        db_table = 'userInfo'

class Room(models.Model):
    roomId = models.CharField(max_length=40, null=True)
    roomState = models.CharField(max_length=4, null=False, default="0")
    aPlayer = models.CharField(max_length=40, null=True)
    bPlayer = models.CharField(max_length=40, null=True)
    aPlayerScore = models.CharField(max_length=40, null=True)
    bPlayerScore = models.CharField(max_length=40, null=True)
    endingWinner = models.CharField(max_length=40, null=True)
    creatTime = models.DateTimeField(auto_now_add=True)
    refreshTime = models.DateTimeField(auto_now=True)
    chainIndex = models.CharField(max_length=20, null=True)

    class Meta:
        db_table = 'roomInfo'

class CheckPoint(models.Model):
    chainId = models.CharField(max_length=40, null=True)
    difficult = models.CharField(max_length=5, null=True)
    initState = models.TextField(max_length=255, null=True)
    goalState = models.TextField(max_length=255, null=True)

    class Meta:
        db_table = 'checkPoint'

